package com.woniuxy.service.impl;

import com.woniuxy.entity.Video;
import com.woniuxy.mapper.VideoMapper;
import com.woniuxy.service.DictionaryService;
import com.woniuxy.service.VideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VideoServiceImpl implements VideoService {
    @Autowired
    private VideoMapper videoMapper;
    //外部函数调用就调用service，用了动态代理模式
    @Autowired
    private DictionaryService dictionaryService;

    //这里通过数据字典转了一道来查询数据
    @Override
    public List<Video> findByJid(int jid) {
        //通过jid到字典中找到对应的所有did,也就是找到了该阶段对应的所有视频
        List<Integer> dids = dictionaryService.findDidsByJid(jid);
        //再通过did找到对应的视频
        return videoMapper.findVideoByDids(dids);
    }


}
